﻿using System;

namespace CollegeSim.Domain.Entities
{
    // Author: Ryan Redburn
    // Project: CollegeSim
    // Date: 2/4/2014

    #region [ Updates ]

    // Author: Ryan Redburn
    // Date: 5/6/2014
    // Revisions: Changed Instructor to reflect 2.0 changes

    #endregion

    /// <summary>
    /// Class used to represent an Instructor. Contains properies, ToString() override.
    /// </summary>
    public class Instructor : Person
    {
        #region [ Fields ]

        private string _officeNumber;

        #endregion

        #region [ Properties ]

        // InstructorID
        // Set by DB
        public int InstructorID { get; set; }

        /// <summary>
        /// Office number for instructor.
        /// </summary>
        public string OfficeNumber
        {
            get { return _officeNumber; }
            set
            {
                if (value == null || value.Length == 5)
                {
                    _officeNumber = value;    
                }
                else
                {
                    throw new ArgumentOutOfRangeException("value", "OfficeNumber must be five characters in length.");
                }
            }
        }

        #endregion

        #region [ Constructors ]

        // Initialize InstructorID
        public Instructor()
        {
            InstructorID = 0;
            PersonID = 0;
        }

        #endregion

        #region [ Methods ]

        /// <summary>
        /// Returns a string representation of an Instructor. LastName, FirstName - PhoneNumber
        /// </summary>
        /// <returns>LastName, FirstName - PhoneNumber</returns>
        public override string ToString()
        {
            return LastName + ", " + FirstName + " - " + PhoneNumber;
        }

        #endregion
    }
}
